<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>判断请求结果</title>
    <script src="js/jquery-3.2.1.min.js"></script>
    <style>
        .red{
            color: red;
        }
        .green{
            color: green;
        }
    </style>
</head>
<body>
<input type="button" value="点击" class="btn">
<div class="ctn"></div>
<script>
    $(".btn").click(function () {
        //URL:/isexists
        //参数:username
        $.ajax({
            url:"http://172.16.16.63:8081/isexists",
            type:"get",
            data:{
                username:"honda1"
            },
        success:function(re) {
            console.log(re);
            if (re.code == 1000) {
                $(".ctn").html("用户名可以使用");
                $(".ctn").addClass("red");
            }else {
                $(".ctn").html(re.msg);
                $(".ctn").addClass("green");
            }
        }
        })
    })
</script>
</body>
</html>